<!DOCTYPE html>
<html>
<?php echo $this->fetch('head.html'); ?>
 
<body>
 <div class="fullscreen">

	<div class="topfixed">
       <div class="t_left"><a href="/index.php?m=forum&a=my" class="goBack"><i class="back"></i></a></div>
       <div class="t_main">发布帖子</div>
   	   
    </div> 
    <div class="paddingheight"></div>

<div id="page" data-role="page">
 
    <div class="main-body pd-5">
    <form method="post" action="<?php echo $this->_var['appadmin']; ?>?m=forum&a=save&ajax=1" id="upload_form" class="form-horizontal ">
    <input type="hidden" name="id" value="<?php echo $this->_var['data']['id']; ?>" />
    
      <div class="input-row">
             
            <input type="text" name="title"  class="txt"   id="title" value="<?php echo $this->_var['data']['title']; ?>" placeholder="请输标题"  >
        
        </div>    
        
        
        <div class="input-row">
            
             <select name="catid" class="txt">
        <option value="0">请选择</option>
        <?php $_from = $this->_var['cat_list']; if (!is_array($_from) && !is_object($_from)) { $_from=array();}; $this->push_vars('', 'c');if (count($_from)):
    foreach ($_from AS $this->_var['c']):
?>
                    <option value="<?php echo $this->_var['c']['catid']; ?>" <?php if ($this->_var['data']['catid'] == $this->_var['c']['catid'] || get ( 'catid' ) == $this->_var['c']['catid']): ?> selected="selected"<?php endif; ?>><?php echo $this->_var['c']['cname']; ?></option>
                    <?php $_from = $this->_var['c']['child']; if (!is_array($_from) && !is_object($_from)) { $_from=array();}; $this->push_vars('', 'c_2');if (count($_from)):
    foreach ($_from AS $this->_var['c_2']):
?>
                        <option value="<?php echo $this->_var['c_2']['catid']; ?>" <?php if ($this->_var['data']['catid'] == $this->_var['c_2']['catid'] || get ( 'catid' ) == $this->_var['c_2']['catid']): ?> selected="selected"<?php endif; ?> class="o_c_2">|__<?php echo $this->_var['c_2']['cname']; ?></option>
                        <?php $_from = $this->_var['c_2']['child']; if (!is_array($_from) && !is_object($_from)) { $_from=array();}; $this->push_vars('', 'c_3');if (count($_from)):
    foreach ($_from AS $this->_var['c_3']):
?>
                        <option value="<?php echo $this->_var['c_3']['catid']; ?>" <?php if ($this->_var['data']['catid'] == $this->_var['c_3']['catid'] || get ( 'catid' ) == $this->_var['c_3']['catid']): ?> selected="selected"<?php endif; ?> class="o_c_3"> |____<?php echo $this->_var['c_3']['cname']; ?></option>
                        <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
                    <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
                    <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
        </select>
             
        </div>
     
        
        <div class="row mgb-10" >
            <div class="col-4-1">&nbsp;封面图片:</div>
            <div class="col-4-3">
     
              	<div class="row">
      		<div id="up1" url="/index.php?m=upload&a=uploadtao&dir=forum&id=<?php echo $this->_var['data']['id']; ?>">
            <div class="btn-upload">
              <input type="file" name="upimg" id="ud"  class="btn-upload-file" onChange="uploadimg('up1')">
             </div>
     
              <input type="hidden" name="imgurl" class="imgurl" value="<?php echo $this->_var['data']['imgurl']; ?>">
              <span class="imgShow">
              <?php if ($this->_var['data']['imgurl']): ?>
              <img src="<?php echo images_site($this->_var['data']['imgurl']); ?>.100x100.jpg">
              <?php endif; ?>
              </span>
          </div>
      </div>
               
            </div>
        </div> 
      
      
      
       <div class="area-row">
             
            <div style="width:90%; margin:0 auto; margin-bottom:10px;">
            <script type="text/html" style="height:300px;" name="content" id="content"><?php echo $this->_var['data']['content']; ?></script>
            </div>
      </div>
            <div class="clearfix"></div>
        </div>  
     <div class="row">
     	<?php $this->assign('tablename','forum'); ?>
     	 <?php echo $this->fetch('picsup.html'); ?> 
     </div>  
    <div class="form-btns">
    
      <button type="button" name="button" id="post-submit" class="btn btn-success btn-larger" value="">发布帖子</button>  
    </div>
    <div style="clear:both;"></div>
    </form>
    </div>
    <?php echo $this->fetch('footer.html'); ?>
</div>

<?php loadEditor();;?> 
<script language="javascript" src="/plugin/My97DatePicker/WdatePicker.js"></script> 
<script src="/plugin/skyweb/lrz.mobile.min.js" ></script>
<script src="/static/js/upload_wap.js"></script>
<script>
var editor=UE.getEditor('content',options)
$(function(){
	$("#post-submit").on("click",function(){
		$.post($("#upload_form").attr("action"),$("#upload_form").serialize(),function(data){
	
			if(!data.error){
				skyToast("发布成功");
				setTimeout(function(){
				goBack();
				},1000);
			}else{
				skyToast(data.message);
			}
		},"json");
	});
});
</script>

</body>
</html>